#include "lib.h"

#include <stdlib.h>
#include "VPGameBase.h"
#include "VPGame.h"
#include "SevenCardStudGame.h"

///////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     VPGameBase::createGame(VPConnection *pConn, GameDBInterface* pDBInterface)
///
/// Static method that should generally be called to create instances of the various games.
///
/// @param  pConn        -   (in) Connection object used to talk to the client via the network
/// @param  pDBInterface -   (in) object that the game should use when accessing the database
///
/// @return returns a pointer to the newly created game instance...or NULL on failure.
///
///////////////////////////////////////////////////////////////////////////////////////////////
VPGameBase * VPGameBase::createGame(VPConnection *pConn, GameDBInterface* pDBInterface)
{
    VPGameBase *pRetVal = NULL;
    switch(pConn->getGameID())
    {
        case VP_FIVE_CARD:
        {
            // all of the standard 5 card video poker games
            pRetVal = new VPGame(pConn, pDBInterface);
            break;
        }

        case VP_SEVEN_CARD:
        {
            // 7 stud poker.
            pRetVal = new SevenCardStudGame(pConn, pDBInterface);
            break;
        }
    }

    return pRetVal;
}